package com.jixiang.dictionary.controller;



import com.baomidou.mybatisplus.extension.api.ApiController;
import com.jixiang.dictionary.service.DsRegionService;
import com.jixiang.model.common.dtos.ResponseResult;
import com.jixiang.model.dictionary.entity.DsRegion;
import com.jixiang.model.user.entity.UsAdress;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (DsRegion)表控制层
 *
 * @author makejava
 * @since 2023-11-05 02:46:55
 */
@RestController
@RequestMapping("region")
public class DsRegionController extends ApiController {
    /**
     * 服务对象
     */
    @Resource
    private DsRegionService dsRegionService;

    @ApiOperation("地址信息")
    @GetMapping("/region")
    public ResponseResult getRegion(@RequestParam(required = false,defaultValue = "0",value = "parentId")String parentId){
        return dsRegionService.getRegion(parentId);
    }

    @ApiOperation("微服务接口获取数据")
    @GetMapping("/serverGetAdrBYId")
    public String serverGetAdrBYId(@RequestParam(required = true,value = "id")Integer id){
        DsRegion dsRegion = dsRegionService.query().eq("id", id).list().get(0);
        return dsRegion.getName();
    }
}

